<%-- 
    Document   : Add
    Created on : Dec 5, 2012, 10:35:58 AM
    Author     : Quang Thao
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Add book</title>
        <%@include file="../LayoutAdmin/InHead.jsp" %>
    </head>
    <script language="JavaScript" type="text/javascript">
        $(document).ready(function(){
            $("#addbook").validate({
                rules:{
                    txtISBN:{minlength: 13,maxlength: 13,required: 1, number: 1},                   
                    txtBookName:{required: 1},
                    txtQuantity:{min: 1,required: 1},
                    txtAuthor:{required: 1},
                    txtPuhlisher:{required: 1},
                    txtYear:{min: 1,required: 1},
                    txtCost:{min: 1,required: 1}
                },
                messages:{
                    txtISBN:{
                        minlength: "<font style='color: red'>Mã sách gồm 13 số</FONT>",
                        maxlength: "<font style='color: red'>Mã sách gồm 13 số</FONT>",
                        required: "<font style='color: red'>*</FONT>",
                        number: "<font style='color: red'>Mã sách gồm 13 số</FONT>"},
                    txtBookName:{
                        required: "<font style='color: red'>*</FONT>"},
                    txtQuantity:{
                        min: "<font style='color: red'>*</FONT>",
                        required: "<font style='color: red'>*</FONT>"},
                    txtAuthor:{
                        required: "<font style='color: red'>*</FONT>"},
                    txtPuhlisher:{
                        required: "<font style='color: red'>*</FONT>"},
                    txtYear:{
                        min: "<font style='color: red'>*</FONT>",
                        required: "<font style='color: red'>*</FONT>"},
                    txtCost:{
                        min: "<font style='color: red'>*</FONT>",
                        required: "<font style='color: red'>*</FONT>"}
                }
            });
        });
    </script>
    <body>
        <div id="horizontal_bar">
            <div id="wrapper">
                <%@include file="../LayoutAdmin/Top.jsp" %>
                <div id="middle">
                    <%@include file="../LayoutAdmin/Middle_Top.jsp" %>
                    <div class="left">
                        <div class="menuitem_ulstyle_vertical">
                            <ul>
                                <li>
                                    <a href="Add.jsp">Thêm</a>
                                </li>
                                <li>
                                    <a href="Delete.jsp">Xóa</a>
                                </li>
                                <li>
                                    <a href="Search.jsp">Tra cứu</a>
                                </li>
                            </ul>
                        </div>
                    </div>
                    <div class="bar_bt_lr"></div>
                    <div class="right">
                        <h1>Thêm sách</h1>
                        <form name="addbook" id="addbook" action="../../AddBookServlet" method="POST">
                            <%

                                if (request.getQueryString() != null) {
                                    String result = request.getQueryString();
                                    if (result.split("=")[0].equals("result")) {
                                        if (result.split("=")[1].equals("true")) {
                            %>
                            <h4>Thêm sách thành công</h4>
                            <%                                        } else {
                            %>
                            <h4>Thêm sách thất bại</h4>
                            <%                                                    }
                                    }
                                }
                            %>
                            <table class="Table3">
                                <tr>
                                    <td>Mã sách :</td>
                                    <td>
                                        <input type="text" name="txtISBN" value="" size="25" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>Tên sách :</td>
                                    <td>
                                        <input type="text" name="txtBookName" value="" size="25" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>Hình ảnh:</td>
                                    <td><input type="file" name="file" size="30" style="height: 25px"/></td>
                                </tr>
                                <tr>
                                    <td>Loại sách :</td>
                                    <td>
                                        <select name="cbxType">
                                            <option value="001">Science</option>
                                            <option value="002">Study</option>
                                            <option value="003">Dictionary</option>
                                            <option value="004">Story</option>
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Số lượng :</td>
                                    <td>
                                        <input type="text" name="txtQuantity" value="" size="25" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>Tác giả :</td>
                                    <td>
                                        <input type="text" name="txtAuthor" value="" size="25" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>Nhà xuất bản :</td>
                                    <td>
                                        <select name="txtPublisher">
                                            <option value="001">Author house</option>
                                            <option value="002">Outskirts press</option>
                                            <option value="003">iUniverse</option>
                                            <option value="004">Infinity Publishing</option>
                                            <option value="005">Llumia Press</option>
                                            <option value="006">Worm</option>
                                            <option value="007">Xlibris</option>
                                            <option value="008">Wheatmark</option>
                                            <option value="009">Aventine press</option>
                                            <option value="010">Bookstand</option>
                                            <option value="011">Old greed</option>
                                            <option value="012">Harsard</option>
                                            <option value="013">Lkio</option>
                                            <option value="014">Kasinwi</option>
                                            <option value="015">Jogh</option>
                                            <option value="016">Helenate</option>
                                            <option value="017">Rolskakion</option>
                                            <option value="018">Biskac</option>
                                            <option value="019">letsdo</option>
                                            <option value="020">Alopr</option>
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Năm xuất bản :</td>
                                    <td>
                                        <input type="text" name="txtYear" value="" size="25" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>Giá :</td>
                                    <td>
                                        <input type="text" name="txtCost" value="" size="25" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>Mô tả :</td>
                                    <td>
                                        <textarea name="txtDescribe" rows="6" cols="40"></textarea>
                                    </td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td>
                                        <input type="submit" value="Thêm sách" name="btnRegister" 
                                               class="Button1"/>
                                        &nbsp;
                                        <input type="reset" value="Làm lại" name="btnReset" 
                                               onclick="this.form.reset();return false;" 
                                               class="Button1"/>
                                    </td>
                                </tr>
                            </table>
                        </form>
                    </div>
                </div>
                <%@include file="../LayoutUser/Bottom.jsp" %>
            </div>
        </div>
    </body>
</html>

